package com.system.common;

import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.Mode;
import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/6/16 11:58
 * @since JDK 1.8
 */
public class ContextUtils {


    private static final String SECRET="0CoJUm6Qyw8W8jud";

    private static final String SECRET2="0102030405060708";

    private static  AES aes = new AES(Mode.CTS, Padding.PKCS5Padding, SECRET.getBytes(), SECRET2.getBytes());


    /**
     * 加密
     * @param content
     * @return
     */
    public static String encrpytHex(String content){
        return aes.encryptHex(content,CharsetUtil.CHARSET_UTF_8);
    }

    /**
     * 解密
     * @param encrptContent
     * @return
     */
    public static String decryptStr(String encrptContent){
        try {
            return aes.decryptStr(encrptContent, CharsetUtil.CHARSET_UTF_8);
        }catch (Exception e){
            e.printStackTrace();
        }
        return encrptContent;
    }



}
